openconnect: openconnect-wrapper: rewrite
authorYousong Zhou <[email protected]>
Mon, 8 May 2017 05:07:47 +0000 (13:07 +0800)
committerYousong Zhou <[email protected]>
Mon, 19 Jun 2017 04:37:24 +0000 (12:37 +0800)
 - use exec directly to eliminate a level in the process tree
 - use "$@" instead of "$*" to pass arguments to openconnect

According to openconnect(8), openconnect will call vpnc-script to
cleanup before quit when it received SIGINT(2) and will quit immediately
when it received SIGTERM (the default signal by kill command)

Before and after the change, openconnect process will be killed first
with SIGINT sent from netifd.  This was decided by the
'proto_kill_command "$config" 2' notify call in the proto script.

SIGKILL is the only other signal that can be sent from netifd when the
process did not quit on SIGINT on time.  There should be no need to trap
on signal 1 3 6 9 (HUP QUIT ABRT KILL)

Signed-off-by: Yousong Zhou <[email protected]>
net/openconnect/Makefile
net/openconnect/files/openconnect-wrapper

index 60953652cf8e7445fc824019d3f3d6efea575587..ec2554c8354e7296daf06ed1b61987da1d8ee762 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=openconnect
 PKG_VERSION:=7.08
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 PKG_USE_MIPS16:=0
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
index 082dfba73ae551ca9fdf36b9ebe2fc06f10de2d7..8a4ff78f98d147ba37cd355412ed2b3283efb75b 100755 (executable)
@@ -10,32 +10,4 @@ test -z "$1" && exit 1
 
 pwfile=$1
 shift
-
-pidfile=/var/run/ocwrap-$$.pid
-
-cleanup()
-{
-       if ! test -z "$pid";then
-               kill $pid
-               wait $pid
-       fi
-       exit 0
-}
-
-cleanup2()
-{
-       if ! test -z "$pid";then
-               kill -2 $pid
-               wait $pid
-       fi
-       exit 0
-}
-
-trap cleanup2 2
-trap cleanup 1 3 6 15
-
-rm -f "$pidfile"
-/usr/sbin/openconnect $* <$pwfile &
-pid=$!
-
-wait $pid
+exec /usr/sbin/openconnect "$@" <$pwfile